package com.xinsoft.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.xinsoft.entity.vo.ErpPurchaseDetailVO;
import com.xinsoft.entity.vo.ErpPurchaseVO;
import lombok.Data;

import java.math.BigDecimal;

/**
 * 采购订单
 * */
@Data
public class KisPurchaseBodyDto {


    private String FEntryID;         // 1,				行号
    private String FInterID;         // 20460,
    private String FItemID;         // 5142,			物料代码
    private String FUnitID;         // 1415,			单位
    private String FQty;         // 330.0000000000,			基本单位数量
    private String FAuxQty;         // 330.0000000000,	数量
    private String FDate;         // 9/12/2023 12:00:00 AM,		日期
    private String FNote;         // ,					备注
    private String FAuxCommitQty;         // 0.0000000000,	关联数量
    private String FStockQty;         // 0.0000000000,	基本单位入库数量
    private String FAuxStockQty;         // 0.0000000000,	入库数量
    private String FSourceTranType;         // 70,			源单类型
    private String FSourceInterId;         // 22046,		源单内码
    private String FSourceBillNo;         // POREQ022044,	源单单号
    private String FOnStockTotalQty;         // 0.0000000000,	当前库存量
    private String FOnOrderTotalQty;         // 0.0000000000,	采购在途量

    public ErpPurchaseDetailVO voToPo(KisPurchaseBodyDto item) {
        if (item == null) {
            return null;
        }
        ErpPurchaseDetailVO erpPurchaseDetailVO = new ErpPurchaseDetailVO();
        erpPurchaseDetailVO.setId(ObjectUtil.isEmpty(item.getFEntryID()) ? null : new Integer(item.getFEntryID()));
        erpPurchaseDetailVO.setHeadId(ObjectUtil.isEmpty(item.getFInterID()) ? null : new Integer(item.getFInterID()));
        erpPurchaseDetailVO.setMaterialId(ObjectUtil.isEmpty(item.getFItemID()) ? null : new Integer(item.getFItemID()));
        erpPurchaseDetailVO.setMainUnitId(ObjectUtil.isEmpty(item.getFUnitID()) ? null : new Integer(item.getFUnitID()));
        erpPurchaseDetailVO.setNum(ObjectUtil.isEmpty(item.getFQty()) ? null : new BigDecimal(item.getFQty()));
        erpPurchaseDetailVO.setAuxNum(ObjectUtil.isEmpty(item.getFAuxQty()) ? null : new BigDecimal(item.getFAuxQty()));
        erpPurchaseDetailVO.setDate(item.getFDate());
        erpPurchaseDetailVO.setNote(item.getFNote());
        erpPurchaseDetailVO.setAuxCommitQty(ObjectUtil.isEmpty(item.getFAuxCommitQty()) ? null : new BigDecimal(item.getFAuxCommitQty()));
        erpPurchaseDetailVO.setStockQty(ObjectUtil.isEmpty(item.getFStockQty()) ? null : new BigDecimal(item.getFStockQty()));
        erpPurchaseDetailVO.setAuxStockQty(ObjectUtil.isEmpty(item.getFAuxStockQty()) ? null : new BigDecimal(item.getFAuxStockQty()));
        erpPurchaseDetailVO.setSourceType(item.getFSourceTranType());
        erpPurchaseDetailVO.setSourceId(item.getFSourceInterId());
        erpPurchaseDetailVO.setSourceCode(item.getFSourceBillNo());
        erpPurchaseDetailVO.setOnStockTotalQty(ObjectUtil.isEmpty(item.getFOnStockTotalQty()) ? null : new BigDecimal(item.getFOnStockTotalQty()));
        erpPurchaseDetailVO.setOnOrderTotalQty(ObjectUtil.isEmpty(item.getFOnOrderTotalQty()) ? null : new BigDecimal(item.getFOnOrderTotalQty()));
        return erpPurchaseDetailVO;
    }


//    {
//          FBrNo: 0,
//          FInterID: 20460,
//          FEntryID: 1,				行号
//          FItemID: 5142,			物料代码
//          FQty: 330.0000000000,			基本单位数量
//          FDate: 9/12/2023 12:00:00 AM,		日期
//          FNote: ,					备注
//          FUnitID: 1415,			单位
//          FAuxCommitQty: 0.0000000000,	关联数量
//          FAuxQty: 330.0000000000,	数量
//          FStockQty: 0.0000000000,	基本单位入库数量
//          FAuxStockQty: 0.0000000000,	入库数量
//          FSourceTranType: 70,			源单类型
//          FSourceInterId: 22046,		源单内码
//          FSourceBillNo: POREQ022044,	源单单号
//          FOnStockTotalQty: 0.0000000000,	当前库存量
//          FOnOrderTotalQty: 0.0000000000,	采购在途量
//          FEntrySelfP0263: I.O.:13102,		销售订单号
//          FEntrySelfP0264: WTW 16857-9		产品号
//          FCommitQty: 0.0000000000,
//          FPrice: 0.1599000000,
//          FAmount: 52.77,
//          FTaxRate: 0.0000000000,
//          FTax: ,
//          FTaxAmount: 6.86,
//          FAuxPrice: 0.1599000000,
//          FSourceEntryID: 1,
//          FCess: 13.00,
//          FMapNumber: ,
//          FMapName: ,
//          FAllAmount: 59.6300,
//          FAuxPropID: 0,
//          FAuxPriceDiscount: 0.1806870000,
//          FPriceDiscount: 0.1806870000,
//          FQtyInvoice: 0.0000000000,
//          FQtyInvoiceBase: 0.0000000000,
//          FAuxTaxPrice: 0.1806870000,
//          FTaxPrice: 0.1806870000,
//          FReceiveAmountFor_Commit: 0.0000,
//          FReceiveAmount_Commit: 0.0000,
//          FSecCoefficient: 0.0000000000,
//          FSecQty: 0.0000000000,
//          FSecCommitQty: 0.0000000000,
//          FContractInterID: 0,
//          FContractEntryID: 0,
//          FContractBillNo: ,
//          FMRPLockFlag: 0,
//          FAuxQtyInvoice: 0.0000000000,
//          FMrpClosed: 0,
//          FDetailID: 269973,
//          FMapID: 0,
//          FSProducingAreaID: 0,
//          FAmtDiscount: 0.0000000000,
//          FCheckAmount: 0.0000,
//          FMrpAutoClosed: 1,
//          FPayApplyAmountFor_Commit: 0.0000,
//          FPayApplyAmount_Commit: 0.0000,
//          FSecStockQty: 0.0000000000,
//          FSecInvoiceQty: 0.0000000000,
//          FPlanMode: 14036,
//          FMTONo: ,
//          FDescount: 0.0000000000,
//          FComplexQty: 330M,
//          FTplEStatus: ,
//          FTplEFail: ,
//          FTplEflat: ,
//          FTplEStock: ,
//          FDistribution: 0,
//          FComCategoryID: 0,
//          FComBrandID: 0,
//          FDistributionID: 0,
//          FProfitRate: 0.0000000000,
//          FSaleDayAverageQty: 0.0000000000,
//          FSaleWeekTotalQty1: 0.0000000000,
//          FSaleWeekTotalQty2: 0.0000000000,
//          FSaleWeekTotalQty3: 0.0000000000,
//          FSaleWeekTotalQty4: 0.0000000000,
//          FBarCode: ,
//          FID_SRC: 0,
//          FEntryID_SRC: 0,
//          FClassID_SRC: 0,
//          FBillNo_SRC: 0,
//          FTplExtendKey1: ,
//          FEntrySelfP0262: ,
//    }
}
